<template>
    <div v-if="isShow">
        <h3>场景切换</h3>
        <hr/>
        <div style="text-align: left; padding: 10px;">
            <el-radio-group v-model="sceneModel" @change="handleChange">
                <el-radio label="3">SuperMap-WebGL模式</el-radio>
                <br/>
                <el-radio label="0">夜景模式</el-radio>
                <br/>
                <el-radio label="1">Revit场景模式</el-radio>
                <br/>
                <el-radio label="2">Arcgis场景模式</el-radio>
            </el-radio-group>
        </div>
    </div>
</template>

<script>
import store from "@/store/store";

export default {
  name: "SwitchScene",
  data(){
    return {
      sharedState: store.state,
      // 场景模式
      sceneModel: "3"
    };
  },
  computed: {
    // 显示控制
    isShow(){
      return this.sharedState.contentShowList[8];
    }
  },
  methods: {
    contentShow(){
      return this.sharedState.contentShowList[8];
    },

    // 修改场景模式
    handleChange(model){
      if (!viewer) {
        return;
      }

      switch (model) {
        case "0": // 夜景模式
                  // 将场景修改为黑色背景
          viewer.imageryLayers.get(0).show = false;
          viewer.scene.globe.baseColor = Cesium.Color.BLACK;
          // 关闭大气层
          viewer.scene.skyAtmosphere.show = false;
          break;

        case "1": // Revit场景模式
                  // 将场景修改为纯色背景
          viewer.imageryLayers.get(0).show = false;
          viewer.scene.globe.baseColor = Cesium.Color.WHITE;
          // 关闭大气层
          viewer.scene.skyAtmosphere.show = false;
          break;

        case "2": // Arcgis场景模式
                  // 将场景修改为纯色背景
          viewer.imageryLayers.get(0).show = false;
          viewer.scene.globe.baseColor = new Cesium.Color(229 / 255, 223 / 255, 211 / 255);
          // 关闭大气层
          viewer.scene.skyAtmosphere.show = false;
          break;

        case "3":
        default:
          viewer.imageryLayers.get(0).show = true;
          viewer.scene.globe.baseColor = new Cesium.Color(0, 0, 0.5, 1);
          // 开启大气层
          viewer.scene.skyAtmosphere.show = true;
      }
    }
  }
};
</script>

<style scoped>
    .el-radio {
        /*height: 30px;*/
        margin-top: 10px;
    }
</style>
